package com.example.chat.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.chat.beans.Video;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface VideoMapper extends BaseMapper<Video> {
    IPage<Video> selectBySearch(Page<Video> pages,
                                @Param("type") int type,
                                @Param("userId") Integer userId);

    List<Video> selectExpire(@Param("now") long now);

    IPage<Video> selectVideoListForB(Page<Video> pages, @Param("name") String name, @Param("videoType") Long videoType, @Param("username") String username,
                                     @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("status") Integer status, @Param("isTop") Integer isTop);

    IPage<Video> selectVideoListForC(Page<Video> pages, @Param("name") String name, @Param("videoType") Long videoType, @Param("username") String username,
                                     @Param("startTime") Long startTime, @Param("endTime") Long endTime, @Param("status") Integer status, @Param("isTop") Integer isTop);

    void updateLikeOrCollect(@Param("videoId") long videoId, @Param("type") int type);

    int getClickCount(@Param("videoId") long videoId);

    int getLikeCount(@Param("videoId") long videoId);
}
